﻿using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FWK.DataLayer.Base;
using System.Data;

namespace CDB.DataLayer.Utilitarios
{
    public class DLUtilitarios:FwDLBase
    {
        #region Construtor
        public DLUtilitarios(string pstrConnection, string pstrProvider)
        {
            
            this.objFwProvider = new FwProvider(pstrProvider, pstrConnection);  
        }
        #endregion

        #region Métodos
        #region Listar Bancos
        public Collection<string> ListarBancos()
        {
            Collection<string> colBancos = new Collection<string>();

            StringBuilder strQuery = new StringBuilder();
            strQuery.Append("sp_helpdb");

            objFwCommand = new FwCommand(strQuery.ToString());
            objFwCommand.CommandType = CommandType.StoredProcedure;

            IDataReader objDataReader = objFwProvider.ExecuteReader(objFwCommand);

            while (objDataReader.Read())
            {
                colBancos.Add(objDataReader.GetString(objDataReader.GetOrdinal("name")));
            }

            return colBancos;
        }
        #endregion
        #endregion
    }
}
